﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using CRM.Entity;

using CRM.BLL;
using DP.Web.UI.Controls;
using DP.Web.UI;
using DP.Common;
using System.Data;

namespace CRM.Web.ComplaintCaseManage
{
    public partial class List : Common.PageBase
    {

        public string ModifyUrl = "Modify.aspx?CASEID={0}";
        #region MyRegion
        /// <summary>
        /// 投诉工单业务访问对象
        /// </summary>
        T_COMPLAINTCASE_BLL bll = new T_COMPLAINTCASE_BLL();
        /// <summary>
        /// 人员内容权限业务访问对象
        /// </summary>
        private T_CONTENTAUTHORITY_BLL caBll = new T_CONTENTAUTHORITY_BLL();
        /// <summary>
        /// 角色状态业务访问对象
        /// </summary>
        private T_ROLEORDERSTATUSAUTHORITY_BLL roleOrderStatusAuthorityBll = new T_ROLEORDERSTATUSAUTHORITY_BLL();
        /// <summary>
        /// 工单状态业务访问对象
        /// </summary>
        private T_WORKORDERSTATUS_BLL workOrderStatusBll = new T_WORKORDERSTATUS_BLL();
        /// <summary>
        /// 数据字典业务访问对象
        /// </summary>
        T_DICTIONARY_BLL dBll = new T_DICTIONARY_BLL();

        #endregion

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            PageHelper.SetPrePageUrl(this.Page);
            gvList.PageSize = StringHelper.ToInt(configBll.GetCacheValueByName(this.Page, "PageSize"), 20);
            PageHelper.SetPopCalender(this.Page, txtCREATETIMEBegin);
            PageHelper.SetPopCalender(this.Page, txtCREATETIMEEnd);

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblExportMaxRows.Text = configBll.GetCacheValueByName(this.Page, "ExportMaxRows");
                txtRecordBegin.Text = StaticConstant.RecordBegin;
                txtRecordEnd.Text = StaticConstant.RecordEnd;
                ddlExtendedBinding();
                ddlSMSSTATUSBinding();
                ddlSTATUSBinding();
                ddlExtendedTimeBinding();

                GetUrlQueryToControl();
                gvDataBinding();
            }
        }

        #region 页面初始化数据绑定

        /// <summary>
        /// DDLs the extended time binding.
        /// </summary>
        private void ddlExtendedTimeBinding()
        {
            ddlExtendedTime.Items.Add(new ListItem("0小时以上", "0"));
            ddlExtendedTime.Items.Add(new ListItem("24小时以上", "24"));
            ddlExtendedTime.Items.Add(new ListItem("48小时以上", "48"));
            ddlExtendedTime.Items.Add(new ListItem("72小时以上", "72"));
        }

        /// <summary>
        /// DDLs the extended binding.
        /// </summary>
        private void ddlExtendedBinding()
        {
            EnumHelper.FillListControl(ddlExtended, typeof(CaseExtended));
            ddlExtended.Items.Insert(0, new ListItem("", ""));
        }

        /// <summary>
        /// 短信回复状态
        /// DDLs the SMSSTATUS binding.
        /// </summary>
        private void ddlSMSSTATUSBinding()
        {
            EnumHelper.FillListControl(ddlSMSSTATUS, typeof(ComplaintReplyStatus));
            ddlSMSSTATUS.Items.Insert(0, new ListItem("", ""));
        }

        /// <summary>
        /// DDLs the STATUS binding.
        /// </summary>
        private void ddlSTATUSBinding()
        {


            ddlSTATUS.DataSource =
                workOrderStatusBll.GetList(String.Format(" and OrderTypeID = '{0}' ",
                                                         ((int)WorkOrderType.投诉工单).ToString()));
            ddlSTATUS.DataTextField = "ORDERSTATUSNAME";
            ddlSTATUS.DataValueField = "ORDERSTATUSID";
            ddlSTATUS.DataBind();
            ddlSTATUS.Items.Insert(0, new ListItem("", ""));
        }


        #endregion

        /// <summary>
        /// 获取 URL 上的参数存入当页面 控件中。
        /// </summary>
        private void GetUrlQueryToControl()
        {
            PageHelper.GetUrlQueryToControl(this.Page);
        }

        /// <summary>
        /// 生成查询条件字符串
        /// </summary>
        private StringBuilder GenerationSQLString()
        {
            StringBuilder sql = new StringBuilder();
            #region 链接地址部分
            if (!String.IsNullOrEmpty(Request.QueryString["CASEID"]))
            {
                sql.Append(" and CASEID like '%" + Request.QueryString["CASEID"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CALLER"]))
            {
                sql.Append(" and CALLER like '%" + Request.QueryString["CALLER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CALLED"]))
            {
                sql.Append(" and CALLED like '%" + Request.QueryString["CALLED"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CALLID"]))
            {
                sql.Append(" and CALLID = '" + Request.QueryString["CALLID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["RECORDCODE"]))
            {
                sql.Append(" and RECORDCODE like '%" + Request.QueryString["RECORDCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CALLTYPE"]))
            {
                sql.Append(" and CALLTYPE like '%" + Request.QueryString["CALLTYPE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CUSTOMERID"]))
            {
                sql.Append(" and CUSTOMERID = '" + Request.QueryString["CUSTOMERID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CUSTOMERNAME"]))
            {
                sql.Append(" and CUSTOMERNAME like '%" + Request.QueryString["CUSTOMERNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["FIRSTCONTACTTEL"]))
            {
                sql.Append(" and FIRSTCONTACTTEL like '%" + Request.QueryString["FIRSTCONTACTTEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ADDRESS"]))
            {
                sql.Append(" and ADDRESS like '%" + Request.QueryString["ADDRESS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["COUNTRY"]))
            {
                sql.Append(" and COUNTRY like '%" + Request.QueryString["COUNTRY"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROVINCE"]))
            {
                sql.Append(" and PROVINCE like '%" + Request.QueryString["PROVINCE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PREFECTURECITY"]))
            {
                sql.Append(" and PREFECTURECITY like '%" + Request.QueryString["PREFECTURECITY"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CITY"]))
            {
                sql.Append(" and CITY like '%" + Request.QueryString["CITY"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VILLAGETOWN"]))
            {
                sql.Append(" and VILLAGETOWN like '%" + Request.QueryString["VILLAGETOWN"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VILLAGE"]))
            {
                sql.Append(" and VILLAGE like '%" + Request.QueryString["VILLAGE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["GROUPTEAM"]))
            {
                sql.Append(" and GROUPTEAM like '%" + Request.QueryString["GROUPTEAM"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VEHICLELOCATION"]))
            {
                sql.Append(" and VEHICLELOCATION like '%" + Request.QueryString["VEHICLELOCATION"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["GPSADDRESS"]))
            {
                sql.Append(" and GPSADDRESS like '%" + Request.QueryString["GPSADDRESS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VINCODE"]))
            {
                sql.Append(" and upper(VINCODE) like '%" + Request.QueryString["VINCODE"].ToUpper() + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BRAND"]))
            {
                sql.Append(" and BRAND like '%" + Request.QueryString["BRAND"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VEHICLETYPE"]))
            {
                sql.Append(" and VEHICLETYPE like '%" + Request.QueryString["VEHICLETYPE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PRODUCTCODE"]))
            {
                sql.Append(" and PRODUCTCODE like '%" + Request.QueryString["PRODUCTCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SERIES"]))
            {
                sql.Append(" and SERIES like '%" + Request.QueryString["SERIES"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MODELS"]))
            {
                sql.Append(" and MODELS like '%" + Request.QueryString["MODELS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ENGINEMODEL"]))
            {
                sql.Append(" and ENGINEMODEL like '%" + Request.QueryString["ENGINEMODEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ENGINEMANUFACTURERS"]))
            {
                sql.Append(" and ENGINEMANUFACTURERS like '%" + Request.QueryString["ENGINEMANUFACTURERS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGOBJECTTYPE"]))
            {
                sql.Append(" and PROCESSINGOBJECTTYPE like '%" + Request.QueryString["PROCESSINGOBJECTTYPE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGDEPARTMENTID"]))
            {
                sql.Append(" and PROCESSINGDEPARTMENTID = '" + Request.QueryString["PROCESSINGDEPARTMENTID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGDEPARTMENTCODE"]))
            {
                sql.Append(" and PROCESSINGDEPARTMENTCODE like '%" + Request.QueryString["PROCESSINGDEPARTMENTCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGDEPARTMENTNAME"]))
            {
                sql.Append(" and PROCESSINGDEPARTMENTNAME like '%" + Request.QueryString["PROCESSINGDEPARTMENTNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGUSERID"]))
            {
                sql.Append(" and PROCESSINGUSERID = '" + Request.QueryString["PROCESSINGUSERID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGUSERNAME"]))
            {
                sql.Append(" and PROCESSINGUSERNAME like '%" + Request.QueryString["PROCESSINGUSERNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PROCESSINGLOGINNAME"]))
            {
                sql.Append(" and PROCESSINGLOGINNAME like '%" + Request.QueryString["PROCESSINGLOGINNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["OBJECTTYPE"]))
            {
                sql.Append(" and OBJECTTYPE like '%" + Request.QueryString["OBJECTTYPE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["COMPLAINTOBJECT"]))
            {
                sql.Append(" and COMPLAINTOBJECT like '%" + Request.QueryString["COMPLAINTOBJECT"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["COMPLAINTTYPE"]))
            {
                sql.Append(" and COMPLAINTTYPE like '%" + Request.QueryString["COMPLAINTTYPE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["COMPLAINTCONTENT"]))
            {
                sql.Append(" and COMPLAINTCONTENT like '%" + Request.QueryString["COMPLAINTCONTENT"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["COMPLAINTLEVEL"]))
            {
                sql.Append(" and COMPLAINTLEVEL like '%" + Request.QueryString["COMPLAINTLEVEL"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["APPROACH"]))
            {
                sql.Append(" and APPROACH like '%" + Request.QueryString["APPROACH"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["HANDLING"]))
            {
                sql.Append(" and HANDLING like '%" + Request.QueryString["HANDLING"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["STATUS"]))
            {
                sql.Append(" and STATUS = '" + Request.QueryString["STATUS"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["RESULTS"]))
            {
                sql.Append(" and RESULTS like '%" + Request.QueryString["RESULTS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATETIMEBegin"]))
            {
                sql.Append(" and  " + bll._dal.GetBeginDateString("CREATETIME", Request.QueryString["CREATETIMEBegin"]) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATETIMEEnd"]))
            {
                sql.Append(" and  " + bll._dal.GetEndDateString("CREATETIME", Request.QueryString["CREATETIMEEnd"]) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATEPEOPLEID"]))
            {
                sql.Append(" and CREATEPEOPLEID = '" + Request.QueryString["CREATEPEOPLEID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CREATEPEOPLE"]))
            {
                sql.Append(" and CREATEPEOPLE like '%" + Request.QueryString["CREATEPEOPLE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYPEOPLEID"]))
            {
                sql.Append(" and LASTMODIFYPEOPLEID = '" + Request.QueryString["LASTMODIFYPEOPLEID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYPEOPLE"]))
            {
                sql.Append(" and LASTMODIFYPEOPLE like '%" + Request.QueryString["LASTMODIFYPEOPLE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["REMARK"]))
            {
                sql.Append(" and REMARK like '%" + Request.QueryString["REMARK"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SERVICENUMBER"]))
            {
                sql.Append(" and SERVICENUMBER like '%" + Request.QueryString["SERVICENUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["MILEAGE"]))
            {
                sql.Append(" and MILEAGE like '%" + Request.QueryString["MILEAGE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PLACEMETHOD"]))
            {
                sql.Append(" and PLACEMETHOD like '%" + Request.QueryString["PLACEMETHOD"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SERVICEFEE"]))
            {
                sql.Append(" and SERVICEFEE like '%" + Request.QueryString["SERVICEFEE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SERVICEHOURS"]))
            {
                sql.Append(" and SERVICEHOURS like '%" + Request.QueryString["SERVICEHOURS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["REPAIRPARTS"]))
            {
                sql.Append(" and REPAIRPARTS like '%" + Request.QueryString["REPAIRPARTS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["HANDLINGINSTRUCTIONS"]))
            {
                sql.Append(" and HANDLINGINSTRUCTIONS like '%" + Request.QueryString["HANDLINGINSTRUCTIONS"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["PRODUCTSATISFACTION"]))
            {
                sql.Append(" and PRODUCTSATISFACTION like '%" + Request.QueryString["PRODUCTSATISFACTION"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SERVICESATISFACTION"]))
            {
                sql.Append(" and SERVICESATISFACTION like '%" + Request.QueryString["SERVICESATISFACTION"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VISITTIMEBegin"]))
            {
                sql.Append(" and VISITTIME >= '" + Request.QueryString["VISITTIMEBegin"].Trim() + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VISITTIMEEnd"]))
            {
                sql.Append(" and VISITTIME < '" + Request.QueryString["VISITTIMEEnd"].Trim() + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VISITCOMPLETEDTIMEBegin"]))
            {
                sql.Append(" and VISITCOMPLETEDTIME >= '" + Request.QueryString["VISITCOMPLETEDTIMEBegin"].Trim() + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VISITCOMPLETEDTIMEEnd"]))
            {
                sql.Append(" and VISITCOMPLETEDTIME < '" + Request.QueryString["VISITCOMPLETEDTIMEEnd"].Trim() + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VISITREMARK"]))
            {
                sql.Append(" and VISITREMARK like '%" + Request.QueryString["VISITREMARK"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BUSINESSDIVISIONID"]))
            {
                sql.Append(" and BUSINESSDIVISIONID = '" + Request.QueryString["BUSINESSDIVISIONID"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BUSINESSDIVISIONNAME"]))
            {
                sql.Append(" and BUSINESSDIVISIONNAME like '%" + Request.QueryString["BUSINESSDIVISIONNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["BUSINESSDIVISIONCODE"]))
            {
                sql.Append(" and BUSINESSDIVISIONCODE like '%" + Request.QueryString["BUSINESSDIVISIONCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYTIMEBegin"]))
            {
                sql.Append(" and  " + bll._dal.GetBeginDateString("LASTMODIFYTIME", Request.QueryString["LASTMODIFYTIMEBegin"]) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["LASTMODIFYTIMEEnd"]))
            {
                sql.Append(" and  " + bll._dal.GetEndDateString("LASTMODIFYTIME", Request.QueryString["LASTMODIFYTIMEEnd"]) + " ");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["CUSTOMERCODE"]))
            {
                sql.Append(" and CUSTOMERCODE like '%" + Request.QueryString["CUSTOMERCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["TODOREMINDERTIMEBegin"]))
            {
                sql.Append(" and TODOREMINDERTIME >= '" + Request.QueryString["TODOREMINDERTIMEBegin"].Trim() + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["TODOREMINDERTIMEEnd"]))
            {
                sql.Append(" and TODOREMINDERTIME < '" + Request.QueryString["TODOREMINDERTIMEEnd"].Trim() + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["REMINDERTIME"]))
            {
                sql.Append(" and REMINDERTIME like '%" + Request.QueryString["REMINDERTIME"] + "%'");
            }

            if (!String.IsNullOrEmpty(Request.QueryString["ENGINENUMBER"]))
            {
                sql.Append(" and ENGINENUMBER like '%" + Request.QueryString["ENGINENUMBER"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DEALERCODE"]))
            {
                sql.Append(" and DEALERCODE like '%" + Request.QueryString["DEALERCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["DEALERNAME"]))
            {
                sql.Append(" and DEALERNAME like '%" + Request.QueryString["DEALERNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["STATIONCODE"]))
            {
                sql.Append(" and STATIONCODE like '%" + Request.QueryString["STATIONCODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["STATIONNAME"]))
            {
                sql.Append(" and STATIONNAME like '%" + Request.QueryString["STATIONNAME"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["OWNERSMOBILEPHONE"]))
            {
                sql.Append(" and OWNERSMOBILEPHONE like '%" + Request.QueryString["OWNERSMOBILEPHONE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["OWNERSOFFICEPHONE"]))
            {
                sql.Append(" and OWNERSOFFICEPHONE like '%" + Request.QueryString["OWNERSOFFICEPHONE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["OWNERSHOMEPHONE"]))
            {
                sql.Append(" and OWNERSHOMEPHONE like '%" + Request.QueryString["OWNERSHOMEPHONE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["OWNERSPEOPLE"]))
            {
                sql.Append(" and OWNERSPEOPLE like '%" + Request.QueryString["OWNERSPEOPLE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["OWNERSPEOPLECODE"]))
            {
                sql.Append(" and OWNERSPEOPLECODE like '%" + Request.QueryString["OWNERSPEOPLECODE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["SMSSTATUS"]))
            {
                sql.Append(" and SMSSTATUS = '" + Request.QueryString["SMSSTATUS"] + "'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VCOUNTRY"]))
            {
                sql.Append(" and VCOUNTRY like '%" + Request.QueryString["VCOUNTRY"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VPROVINCE"]))
            {
                sql.Append(" and VPROVINCE like '%" + Request.QueryString["VPROVINCE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VPREFECTURECITY"]))
            {
                sql.Append(" and VPREFECTURECITY like '%" + Request.QueryString["VPREFECTURECITY"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VCITY"]))
            {
                sql.Append(" and VCITY like '%" + Request.QueryString["VCITY"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VVILLAGETOWN"]))
            {
                sql.Append(" and VVILLAGETOWN like '%" + Request.QueryString["VVILLAGETOWN"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VVILLAGE"]))
            {
                sql.Append(" and VVILLAGE like '%" + Request.QueryString["VVILLAGE"] + "%'");
            }
            if (!String.IsNullOrEmpty(Request.QueryString["VGROUPTEAM"]))
            {
                sql.Append(" and VGROUPTEAM like '%" + Request.QueryString["VGROUPTEAM"] + "%'");
            }

            if (!String.IsNullOrEmpty(Request.QueryString["Extended"]))
            {
                string caseStatus = workOrderStatusBll.GetSessionStatusConditions(this.Page, ((int)WorkOrderType.投诉工单).ToString(), StatusType.中间节点);
                switch ((CaseExtended)Enum.Parse(typeof(CaseExtended), PageHelper.GetQueryString(this.Page, "Extended")))
                {
                    case CaseExtended.否:
                        {
                            sql.Append(String.Format(" and ( Status not in ({0}) Or ToDoReminderTime is null  Or (Status in ({0}) and ToDoReminderTime is not null and ToDoReminderTime >= sysdate) ) ", caseStatus));
                        }
                        break;
                    case CaseExtended.是:
                        {
                            sql.Append(String.Format(" and Status in ({0}) and ToDoReminderTime is not null and ToDoReminderTime+({1}/24) < sysdate ", caseStatus, ddlExtendedTime.SelectedValue.Trim()));
                        }
                        break;

                }
            }
			
            #endregion

            #region 权限部分
            if (!UserLoginInfo.IsAdministrator())
            {
                //操作员当前事业务数据
                sql.Append(" and BUSINESSDIVISIONCODE = '" + _userLoginInfo.UserEntity.BUSINESSDIVISIONCODE.Trim() + "'");

                //操作员有权看到人员的数据
                switch (UserLoginInfo.GetCurrentUserType())
                {
                    case UserType.中心部门:
                        {
                            DepartmentType departmentType = (DepartmentType)Enum.Parse(typeof(DepartmentType), _userLoginInfo.DepartmentEntity.ISCENTER.ToString());
                            if (departmentType == DepartmentType.服务部门)
                            {
                                sql.Append(String.Format(" and ProcessingObjectType = '{0}' ", _userLoginInfo.UserEntity.USERTYPE.Trim()));
                                sql.Append(String.Format(" and ProcessingDepartmentID = '{0}' ", _userLoginInfo.UserEntity.DEPARTMENTID));
                                sql.Append(caBll.GenerateContentAuthorityConditions(_userLoginInfo, "ProcessingUserID", true));

                            }
                            else
                            {
                                //操作员有权看到人员的数据
                                //sql.Append(caBll.GenerateContentAuthorityConditions(_userLoginInfo, "CREATEPEOPLEID"));
                            }
                        }
                        break;
                    case UserType.供应商:
                    case UserType.市场部:
                    case UserType.服务商:
                    case UserType.经销商:
                        {
                            sql.Append(String.Format(" and ProcessingObjectType = '{0}' ", _userLoginInfo.UserEntity.USERTYPE.Trim()));
                            sql.Append(String.Format(" and ProcessingDepartmentID = '{0}' ", _userLoginInfo.UserEntity.DEPARTMENTID));
                            //sql.Append(caBll.GenerateContentAuthorityConditions(_userLoginInfo, "ProcessingUserID", true));
                        }
                        break;
                }




            } 
            #endregion

            return sql;

        }

        /// <summary>
        /// 页面数据绑定
        /// </summary>
        private void gvDataBinding()
        {
            #region 查询条件字符串
            StringBuilder sql = GenerationSQLString();
            #endregion

            List<T_COMPLAINTCASE_Entity> list;

            //获取总的记录条数
            gvList.RecordCount = (int)bll.GetCount(sql.ToString());

            list = bll.GetList(sql.ToString(), gvList.CurrentPageIndex * gvList.PageSize, gvList.PageSize, gvList.SortConditions);

            gvList.DataSource = list;
            gvList.DataKeyNames = new string[] { "CASEID", "ToDoReminderTime", "STATUS", "PROCESSINGCOMPLETEDTIME" };
            gvList.DataBind();

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string url = HttpContext.Current.Request.Url.AbsolutePath;
            PageHelper.GetControlToUrlQuery(this.Page, ref url);
            Response.Redirect(url);
        }

        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            string fileName = "ComplaintCase";
            fileName += _userLoginInfo.UserEntity.LOGINNAME.ToUpper();
            if (UserLoginInfo.IsAdministrator())
            {
                PageHelper.ShowMessage(this.Page, "请不要用系统管理导出数据！");
                return;
            }

            int recordBegin = StringHelper.ToInt(txtRecordBegin.Text.Trim(), 0);
            if (recordBegin != 0)
            {
                recordBegin--;
            }
            int recordEnd = StringHelper.ToInt(txtRecordEnd.Text.Trim(), 0);
            if (recordEnd != 0)
            {
                recordEnd--;
            }
            int recordCount = recordEnd - recordBegin;
            if (recordCount >= StringHelper.ToInt(configBll.GetCacheValueByName(this.Page, "ExportMaxRows"), 10000))
            {
                PageHelper.ShowMessage("导出区间大于单次导出数！");
                return;
            }

            StringBuilder sql = GenerationSQLString();
            DataTable dataTable = bll.GetDataTable(sql.ToString(), recordBegin, recordCount, gvList.SortConditions);
            //StringBuilder sql = GenerationSQLString();
            //DataTable dataTable = bll.GetDataTable(sql.ToString(), gvList.SortConditions);

            List<NPOIExcelHelper.FieldInfo> fieldInfos = new List<NPOIExcelHelper.FieldInfo>();

            #region 导出数据列

            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CASEID", "工单编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CALLER", "来电号码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CALLED", "被叫号码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CALLID", "主叫标识"));
            //fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RECORDCODE", "录音代码"));
            //fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CALLTYPE", "来电类型"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CUSTOMERID", "客户编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CUSTOMERNAME", "客户姓名"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("FIRSTCONTACTTEL", "首选联系号码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ADDRESS", "详细地址"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COUNTRY", "国家"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROVINCE", "省份"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PREFECTURECITY", "地级市"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CITY", "区/县/市"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VILLAGETOWN", "乡/镇/街道"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VILLAGE", "村"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("GROUPTEAM", "组/队"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VEHICLELOCATION", "车辆所在地"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("GPSADDRESS", "GPS地址"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VINCODE", "整机编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("BRAND", "品牌"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VEHICLETYPE", "类型"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PRODUCTCODE", "产品代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SERIES", "系列"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("MODELS", "机型"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ENGINEMODEL", "发动机型号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ENGINEMANUFACTURERS", "发动机厂家"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGOBJECTTYPE", "处理对象类型", EnumHelper.EnumToDictionary(typeof(UserType)).ToDictionary(p => p.Key.ToString(), p => p.Value)));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGDEPARTMENTID", "处理部门编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGDEPARTMENTCODE", "处理部门代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGDEPARTMENTNAME", "处理部门名称"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGUSERID", "处理人编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGUSERNAME", "处理人姓名"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGLOGINNAME", "处理人登录名"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("OBJECTTYPE", "投诉对象类型"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLAINTOBJECT", "投诉对象"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLAINTTYPE", "投诉类型"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLAINTCONTENT", "投诉内容"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLAINTLEVEL", "投诉等级"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("APPROACH", "处理方法"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("HANDLING", "处理方式"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("STATUS", "处理状态", workOrderStatusBll.GetList().ToDictionary(p => p.ORDERSTATUSID.ToString(), p => p.ORDERSTATUSNAME)));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RESULTS", "处理结果"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CREATETIME", "创建时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CREATEPEOPLEID", "创建人编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CREATEPEOPLE", "创建人"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("LASTMODIFYPEOPLEID", "最后修改人编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("LASTMODIFYPEOPLE", "最后修改人"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("REMARK", "备注"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SERVICENUMBER", "维修人数"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("MILEAGE", "里程"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PLACEMETHOD", "到位方式"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SERVICEFEE", "维修费用"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SERVICEHOURS", "维修工时"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("REPAIRPARTS", "维修零部件"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("HANDLINGINSTRUCTIONS", "处理说明"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PRODUCTSATISFACTION", "产品满意程度"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SERVICESATISFACTION", "服务满意程度"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VISITTIME", "回访时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VISITREMARK", "回访备注"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("BUSINESSDIVISIONID", "事业部编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("BUSINESSDIVISIONNAME", "事业部名称"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("BUSINESSDIVISIONCODE", "事业部代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("LASTMODIFYTIME", "最后修改时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("CUSTOMERCODE", "客户代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("TODOREMINDERTIME", "待办提醒时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("REMINDERTIME", "待办提醒时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("HELPUSERID", "回访人"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("HELPUSERNAME", "帮办人"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DISPATCHINGTIME", "派工时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGCOMPLETEDTIME", "处理完成时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("REMINDERNUMBER", "提醒次数"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ENGINENUMBER", "发动机编号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DEALERCODE", "经销商代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DEALERNAME", "经销商名称"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("STATIONCODE", "服务商代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("STATIONNAME", "服务商名称"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("OWNERSMOBILEPHONE", "车主手机"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("OWNERSOFFICEPHONE", "车主办公电话"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("OWNERSHOMEPHONE", "车主家庭电话"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("OWNERSPEOPLE", "车主姓名"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("OWNERSPEOPLECODE", "车主代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SMSSTATUS", "短信状态"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DISPATCHINGTYPE", "派工类型", EnumHelper.EnumToDictionary(typeof(DispatchingType)).ToDictionary(p => p.Key.ToString(), p => p.Value)));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VISITSITUATION", "回访情况"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RETURNTIME", "退回时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RETURNPEOPLE", "退回人"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RETURNCONTENT", "退回原因"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ISVISITCOMPLATE", "是否回访成功"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PROCESSINGMARKCODE", "派工市场部代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PRODUCTREASON", "产品不满意原因"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("SERVICEREASON", "服务不满意原因"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("NOTCLOSEREASON", "未闭环原因"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("LASTREMINDERTIME", "最后提醒时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("REMINDERLEVEL", "提醒级别"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("WORKTIME", "工作时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RECEIVETIME", "收到反馈时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RECEIVECONTENT", "收到反馈内容"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("RECEIVEPEOPLE", "收到反馈号码或工号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DEPARTURETIME", "出发反馈时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DEPARTURECONTENT", "出发反馈内容"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("DEPARTUREPEOPLE", "出发反馈号码或工号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ARRIVALTIME", "到达反馈时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ARRIVALCONTENT", "到达反馈内容"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ARRIVALPEOPLE", "到达反馈号码或工号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLETEDTIME", "完工反馈时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLETEDCONTENT", "完工反馈内容"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLETEDPEOPLE", "完工反馈号码或工号"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("PURCHASEDATE", "购机日期"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("COMPLETELENGTH", "完工时长"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ISCULTIVATE", "是否全面培训"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("ISTOTALCHECKING", "是否全面检查"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("FIRSTVISITTIME", "首次回访时间"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("USERRECOMMENDED", "用户建议"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VEHICLEMARKCODE", "车辆市场部代码"));
            fieldInfos.Add(new NPOIExcelHelper.FieldInfo("VEHICLEMARKNAME", "车辆市场部名称"));


            #endregion

            NPOIExcelHelper.MemoryStreamMaxRows = StringHelper.ToInt(configBll.GetCacheValueByName(this.Page, "MemoryStreamMaxRows"), 0);
            fileName = NPOIExcelHelper.DataTableToExcel(dataTable, fieldInfos, fileName + ".xls");
            UserLoginInfo.WriteLog(LogType.导出, "投诉工单导出", "投诉工单管理", fileName);
            dataTable.Clear();
            dataTable = null;
            GC.Collect();
        }

        #region GridView 事件
        /// <summary>
        /// GridView 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            T_COMPLAINTCASE_Entity entity = new T_COMPLAINTCASE_Entity();
            entity.CASEID = StringHelper.ToLong((sender as GridView).DataKeys[e.RowIndex].Values[0].ToString());

            long rel = bll.Delete(entity);
            if (rel > 0)
            {
                Response.Redirect(HttpContext.Current.Request.RawUrl);
            }
            else
            {

            }

        }

        /// <summary>
        /// GridView 行数据绑定事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string temp = string.Empty;
            switch (e.Row.RowType)
            {
                case DataControlRowType.DataRow:
                    {
                        GridView gv = (sender as GridView);
                        for (int i = 0; i < gv.Columns.Count; i++)
                        {
                            TemplateField tf = gv.Columns[i] as TemplateField;
                            if (tf != null)
                            {
                                #region 存储值 转换成  显示值
                                switch (tf.HeaderText)
                                {
                                    case "操作":
                                        {
                                            e.Row.Cells[i].Attributes.Add("style", "white-space: nowrap;");
                                        }
                                        break;
                                    default:
                                        {
                                            e.Row.Cells[i].Attributes.Add("style", "white-space: nowrap;");
                                        }
                                        break;

                                }
                                #endregion
                            }

                            BoundField bf = gv.Columns[i] as BoundField;
                            if (bf != null)
                            {
                                #region 存储值 转换成  显示值
                                switch (bf.DataField)
                                {                                    
                                    case "COMPLAINTTYPE":
                                        {
                                            try
                                            {
                                                temp = e.Row.Cells[i].Text.Trim();
                                                temp = dBll.GetCacheValueByTypeKey(this.Page, "ComplaintType", temp);
                                                e.Row.Cells[i].Text = temp;
                                            }
                                            catch (Exception ex)
                                            {

                                            }
                                        }
                                        break;
                                    case "STATUS":
                                        {
                                            try
                                            {
                                                temp = e.Row.Cells[i].Text.Trim();
                                                T_WORKORDERSTATUS_Entity entity =
                                                    workOrderStatusBll.GetPageItem_T_WORKORDERSTATUS_EntityByKey(this.Page, StringHelper.ToInt(temp, 0));
                                                if (entity != null)
                                                {
                                                    temp = entity.ORDERSTATUSNAME;
                                                    if (!String.IsNullOrEmpty(entity.RECORDSTYLE))
                                                    {
                                                        e.Row.Attributes["style"] = entity.RECORDSTYLE;

                                                    }
                                                }
                                                e.Row.Cells[i].Text = temp;
                                            }
                                            catch (Exception ex)
                                            {
                                                
                                            }
                                        }
                                        break;
                                    case "VISITREMARK":
                                        {
                                            temp = e.Row.Cells[i].Text.Trim();
                                            temp = (temp.Length >= 5) ? temp.Substring(0, 5) + ".." : temp;
                                            e.Row.Cells[i].Text = temp;
                                        }
                                        break;
                                    default:
                                        {

                                        }
                                        break;
                                }
                                #endregion
                            }
                        }

                        #region 超期样式
                        DateTime dt = DateTime.Now;
                        temp = (gv.DataKeys[e.Row.RowIndex].Values["ToDoReminderTime"] == null) ? "" : gv.DataKeys[e.Row.RowIndex].Values["ToDoReminderTime"].ToString();
                        string status = (gv.DataKeys[e.Row.RowIndex].Values["STATUS"] == null) ? "" : gv.DataKeys[e.Row.RowIndex].Values["STATUS"].ToString();
                        if (DateTime.TryParse(temp, out dt))
                        {
                            if (dt.CompareTo(DateTime.Now) < 0)
                            {
                                try
                                {
                                    if (workOrderStatusBll.GetSessionStatusType(this.Page, status) == StatusType.中间节点)
                                    {
                                        e.Row.Attributes["style"] = configBll.GetCacheValueByName(this.Page, "ExtendedStyle");
                                    }
                                }
                                catch (Exception)
                                {

                                }
                            }
                        }
                        temp = (gv.DataKeys[e.Row.RowIndex].Values["PROCESSINGCOMPLETEDTIME"] == null) ? "" : gv.DataKeys[e.Row.RowIndex].Values["PROCESSINGCOMPLETEDTIME"].ToString();
                        if (DateTime.TryParse(temp, out dt))
                        {
                            if (dt.AddHours(4).CompareTo(DateTime.Now) < 0)
                            {
                                try
                                {
                                    if (workOrderStatusBll.GetSessionStatusType(this.Page, status) == StatusType.回访节点)
                                    {
                                        e.Row.Attributes["style"] = configBll.GetCacheValueByName(this.Page, "ExtendedStyle");
                                    }
                                }
                                catch (Exception)
                                {

                                }
                            }
                        }
                        #endregion
                    }
                    break;
                case DataControlRowType.Header:
                    {

                    }
                    break;
                case DataControlRowType.Pager:
                    {

                    }
                    break;
                case DataControlRowType.EmptyDataRow:
                    {


                    }
                    break;
                default:

                    break;
            }

        }

        /// <summary>
        /// GridView 行创建事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvList_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.DataRow:
                    {

                    }
                    break;
                case DataControlRowType.Header:
                    {

                    }
                    break;
                case DataControlRowType.Pager:
                    {

                    }
                    break;
                case DataControlRowType.EmptyDataRow:
                    {


                    }
                    break;
                default:

                    break;
            }

        }
        #endregion
    }
}
